'*******************************************************************************
' *  
' *  Product: GSALib
' *  Description: A C# API for accessing the Google Search Appliance.
' *
' *  (c) Copyright 2008 Michael Cizmar + Associates Ltd.  (MC+A)
' *  
'*******************************************************************************


Imports System
Imports System.Collections.Generic
Imports System.Text

Namespace GSALib.Constants
    ''' <summary>
    ''' Class provides Methods/Members to set Search Region
    ''' <para>Author Albert Ghukasyan</para>    
    ''' </summary>
    Public NotInheritable Class SearchRegion
#Region "Variables"

        ''' <summary>
        ''' Search Everywhere
        ''' </summary>     
        Public Shared ANY As New SearchRegion("any")

        ''' <summary>
        ''' Search in Titles
        ''' </summary>
        Public Shared TITLE As New SearchRegion("title")

        ''' <summary>
        ''' Search in URL
        ''' </summary>
        Public Shared URL As New SearchRegion("url")

        Private value As String

#End Region

#Region "Constructor"

        Private Sub New(ByVal value As String)
            Me.value = IIf((value Is Nothing), "", value)
        End Sub

#End Region

#Region "Methods"

        Public Function hashCode() As Integer
            Return IIf(value Is Nothing, 0, value.GetHashCode())
        End Function

        Public Function equals(ByVal o As Object) As Boolean
            Dim retval As Boolean = False
            If o IsNot Nothing AndAlso TypeOf o Is SearchRegion Then
                Dim other As SearchRegion = DirectCast(o, SearchRegion)
                retval = other.value.Equals(Me.value)
            End If
            Return retval
        End Function

        Public Function getValue() As String
            Return value
        End Function

#End Region
    End Class
End Namespace
